//
//  UILabel+Extension.swift
//  weibo
//
//  Created by 吴婷婷 on 15/11/5.
//  Copyright © 2015年 wutingting. All rights reserved.
//

import UIKit

extension UILabel {
    
    convenience init(title: String, color: UIColor = UIColor.darkGrayColor(), fontSize: CGFloat = 14, screenInsert: CGFloat = 0){
        
        self.init()
        
        text = title
        textColor = color
        numberOfLines = 0
        font = UIFont.systemFontOfSize(fontSize)
        
        if screenInsert > 0 {
            textAlignment = NSTextAlignment.Left
            // 设置换行宽度
            preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * screenInsert
        } else {
            textAlignment = NSTextAlignment.Center
        }
    }
    
    
}
